﻿Imports VN.INS.BL.BC
Imports VN.INS.DL.DALC
Imports VN.INS.BL.BE

Public Class GeneralBC

    Public Function ListaTablaGeneral(ByVal strTabla As String) As DataTable
        Dim objUsuarioDA As GeneralDA
        Dim objDt As DataTable

        Try
            objUsuarioDA = New GeneralDA
            objDt = objUsuarioDA.ListaTablaGeneral(strTabla)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaOficinaZonal(ByVal persona As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaOficinaZonal(persona)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function


    'By Tigrito (20/08/2013): Obtiene el periodo (mes) del Plan de Trabajo que esta Activo
    Public Function ListaPlanTrabajoMensualActivo(ByVal strAnho As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaPlanTrabajoMensualActivo(strAnho)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaMes(ByVal ano As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaMes(ano)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaMes(ByVal ptp As String, ByVal param As String, ByVal strAnho As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaMes(ptp, param, strAnho)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaMesFichaMonitoreo(ByVal ptp As String, ByVal param As String, ByVal strAnho As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaMesFichaMonitoreo(ptp, param, strAnho)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaMesInforme(ByVal ptp As String, ByVal param As String, ByVal strAnho As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaMesInforme(ptp, param, strAnho)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function GenerarCodigo(ByVal strTabla As String, ByVal strCampo As String, ByVal strPrefijo As String) As String
        Dim objGeneralDA As GeneralDA
        Dim strCodigo As String
        Try
            objGeneralDA = New GeneralDA
            strCodigo = objGeneralDA.GenerarCodigo(strTabla, strCampo, strPrefijo)
            Return strCodigo
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function GenerarCodigoNumero(ByVal strTabla As String, ByVal strCampo As String) As Integer
        Dim objGeneralDA As GeneralDA
        Dim intCodigo As Integer
        Try
            objGeneralDA = New GeneralDA
            intCodigo = objGeneralDA.GenerarCodigoNumero(strTabla, strCampo)
            Return intCodigo
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function GenerarCodigoNumeroString(ByVal strTabla As String, ByVal strCampo As String) As String
        Dim objGeneralDA As GeneralDA
        Dim intCodigo As Integer
        Try
            objGeneralDA = New GeneralDA
            intCodigo = objGeneralDA.GenerarCodigoNumeroString(strTabla, strCampo)
            Return intCodigo
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function FechaAvanceSemanal(ByVal strAnhioFirma As String) As String
        Dim objGeneralDA As GeneralDA
        Dim strFecha As String

        Try
            objGeneralDA = New GeneralDA
            strFecha = objGeneralDA.FechaAvanceSemanal(strAnhioFirma)
            Return strFecha
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    'By Tigrito 09/05/2013
    Public Function PeriodoAnteriorAvanceSemanal(ByVal strAnhioFirma As String) As String
        Dim objGeneralDA As GeneralDA
        Dim strFecha As String
        Try
            objGeneralDA = New GeneralDA
            strFecha = objGeneralDA.PeriodoAnteriorAvanceSemanal(strAnhioFirma)
            Return strFecha
        Catch ex As Exception
            Throw ex
        End Try
    End Function



    Public Function FechaAvanceMensual() As String
        Dim objGeneralDA As GeneralDA
        Dim strFecha As String

        Try
            objGeneralDA = New GeneralDA
            strFecha = objGeneralDA.FechaAvanceMensual()
            Return strFecha
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function EstadoFecha(ByVal strPeriodo As String) As String
        Dim objGeneralDA As GeneralDA
        Dim strFecha As String

        Try
            objGeneralDA = New GeneralDA
            strFecha = objGeneralDA.EstadoFecha(strPeriodo)
            Return strFecha
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function EstadoFechaMensual(ByVal strPeriodo As String) As String
        Dim objGeneralDA As GeneralDA
        Dim strFecha As String

        Try
            objGeneralDA = New GeneralDA
            strFecha = objGeneralDA.EstadoFechaMensual(strPeriodo)
            Return strFecha
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function EstadoFechaPAC(ByVal strPeriodo As String) As String
        Dim objGeneralDA As GeneralDA
        Dim strFecha As String

        Try
            objGeneralDA = New GeneralDA
            strFecha = objGeneralDA.EstadoFechaPAC(strPeriodo)
            Return strFecha
        Catch ex As Exception
            Throw ex
        End Try
    End Function
    Public Function ListaPeriodoReporte(ByVal strEstado As String, ByVal strOrden As String, ByVal ano As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaPeriodoReporte(strEstado, strOrden, ano)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaPeriodoMensual(ByVal strEstado As String, ByVal strOrden As String, ByVal ano As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaPeriodoMensual(strEstado, strOrden, ano)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaEjecutor() As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable

        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaEjecutor()
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaRegion(ByVal strPPER As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable
        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaRegion(strPPER)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaProvincia(ByVal strPPER As String, ByVal strUbigeo As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable
        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaProvincia(strPPER, strUbigeo)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function ListaDistrito(ByVal strPPER As String, ByVal strUbigeo As String) As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable
        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.ListaDistrito(strPPER, strUbigeo)
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub Acceso_Sistema(ByVal strUsuario As String)
        Dim objGeneralDA As GeneralDA
        Try
            objGeneralDA = New GeneralDA
            objGeneralDA.Acceso_Sistema(strUsuario)
        Catch ex As Exception
            Throw ex
        End Try
    End Sub

    Public Function CargaAnoActivo() As DataTable
        Dim objGeneralDA As GeneralDA
        Dim objDt As DataTable
        Try
            objGeneralDA = New GeneralDA
            objDt = objGeneralDA.CargaAnoActivo()
            Return objDt
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Periodo_Activo_Ficha_Monitoreo(ByVal strPer As String) As String
        Dim objGeneralDA As GeneralDA
        Dim strPeriodo As String
        Try
            objGeneralDA = New GeneralDA
            strPeriodo = objGeneralDA.Periodo_Activo_Ficha_Monitoreo(strPer)
            Return strPeriodo
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Function Verificar_Periodo_Activo_General(ByVal strTipoPeriodo As String, ByVal strPeriodo As String) As String
        Dim objGeneralDA As GeneralDA
        Dim Resultado As String
        Try
            objGeneralDA = New GeneralDA
            Resultado = objGeneralDA.Verificar_Periodo_Activo_General(strTipoPeriodo, strPeriodo)
            Return Resultado
        Catch ex As Exception
            Throw ex
        End Try
    End Function


End Class
